#pragma once
#include <iostream>
#include <string>
class task
{
public:
    task(){}
    task(int x, int y, char op)
        :_x(x), _y(y), _op(op)
    {}
    task(const task& tmp)
        :_x(tmp._x), _y(tmp._y), _op(tmp._op), _reasult(tmp._reasult)
    {}
    task& operator=(const task& tmp)
    {
        _x = tmp._x, _y = tmp._y, _op = tmp._op, _reasult = tmp._reasult;
        return *this;
    }
    void run()
    {
        switch(_op)
        {
            case '+': _reasult = _x + _y;break;
            case '-': _reasult = _x - _y;break;
            case '*': _reasult = _x * _y;break;
            case '/': _reasult = _x / _y;break;
            default: std::cout << "运算符错误" << std::endl;break;
        }
    }
    void operator()()
    {
        run();
    }
    std::string GetResult()
    {
        return std::to_string(_x) + _op + std::to_string(_y) + "=" + std::to_string(_reasult);
    }
    std::string GetRaw()
    {
        return std::to_string(_x) + _op + std::to_string(_y);
    }
private:
    int _x;
    int _y;
    char _op;
    int _reasult;
};